Data is stored and manipulated in digital computer processors in binary form. Binary data consists of a series of digits, either 0 or 1, which represent numbers in the binary, or base two, number system. Binary data is generally divided into data words, numbers which may have various lengths such as 8 digits, or bits. Typical lengths for data words in digital computers include 4, 8, 16, 32, 64 or 128 bits.
Binary data is often scrambled, or encrypted, to keep it secure and private. A data encryption algorithm is applied to the target data to scramble the data into an unreadable form. The encrypted data can then be restored only by someone with a key, or a number which enables a decryption algorithm to unscramble the data. For example, financial information stored in computers by banks may be encrypted to protect depositor information from tampering. Commercial transactions carried out over e-mail or the Internet may be encrypted. Digital cellular telephone calls may be encrypted to protect the privacy of callers. As digital data becomes more widely used, encryption becomes more critical.
Speed is very important for encryption algorithms. Encryption algorithms comprise complex mathematical formulas which can be slow and complex. Generally, the more secure the encryption algorithm used, the slower it is.
Some data encryption algorithms require a count of like signals in a data word, either the number of ones or the number of zeros. Prior solutions which rely on counters or adders to calculate the number of like signals are limited by the slow operation of the counters or adders. For example, each bit of a data word must be shifted into a counter one by one to count the number of like signals. This process can require multiple clock cycles for every bit that is shifted into the counter, resulting in a delay of tens or even hundreds of clock cycles to calculate the number of like signals in a typical length data word such as 64 bits. If this process takes place in a microprocessor, typically instructions can be carried out in one or only a few clock cycles. In a superscalar microprocessor, multiple instructions can be carried out in only one clock cycle. In either case, the delay required by a counter greatly slows down the execution of an encryption algorithm. Once the microprocessor triggers the calculation of the number of like signals in a data word, it must then wait or move to another task while a counter or adder slowly performs the task.
A need therefore exists for a circuit to rapidly count the number of like signals in a data word in a minimum number of clock cycles. An additional need exists for a circuit which can be extended to count data words of differing lengths, and which can provide a count for selected portions of a data word.